﻿using System;
using System.IO;

namespace Ndns.Packet
{
    internal class PacketEndOfStreamException : EndOfStreamException
    {
        public PacketEndOfStreamException() { }

        public PacketEndOfStreamException(string message) : base(message) { }

        public PacketEndOfStreamException(string message, Exception inner) : base(message, inner) { }

        public static void CheckValue(long value)
        {
            if (value == -1)
                throw new EndOfStreamException();
        }
        public static void CheckValue(int value)
        {
            if (value == -1)
                throw new EndOfStreamException();
        }
        public static void CheckValue(params int[] values)
        {
            foreach (var val in values)
            {
                if (val == -1)
                    throw new EndOfStreamException();
            }
        }
        public static void CheckValue(params long[] values)
        {
            foreach (var val in values)
            {
                if (val == -1)
                    throw new EndOfStreamException();
            }
        }
    }
}
